<%@page import="com.tubeonfire.model.AdvertisingModel"%>
<%@page import="com.tubeonfire.entity.Advertising"%>
<%@page import="com.tubeonfire.entity.Channel"%>
<%@page import="com.tubeonfire.model.ChannelModel"%>
<%@page import="com.tubeonfire.search.TubeSearchModel"%>
<%@page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@page import="com.tubeonfire.model.TagModel"%>
<%@page import="com.tubeonfire.model.PlaylistModel"%>
<%@page import="com.tubeonfire.model.TubeModel"%>
<%@page import="com.tubeonfire.entity.Tag"%>
<%@page import="com.tubeonfire.entity.Playlist"%>
<%@page import="com.tubeonfire.entity.Tube"%>
<%@page import="java.util.List"%>
<div id="rightsidecontent">
	<div id="rightsidecontent_inner">
		<aside>
			<%
				int place = 8;
				int position = 999;
				String isAdmin = request.getParameter("isAdmin");
				Advertising ads01 = AdvertisingModel.getByPlaceAndPosition(place,
						position);
				if (ads01 != null && ads01.getId().length() > 0) {
			%>
			<div class="advWrap adv-250x250 clearafter" style="border: none;">
				<%
					if (ads01.getType() == 1) {
				%>
				<%=ads01.getContent()%>
				<%
					} else {
							String imgUrl = ads01.getContent();
							imgUrl = "/image?key=" + imgUrl + "&size=250";
				%>
				<a title="<%=ads01.getTitle()%>" href="<%=ads01.getLink()%>"> <img
					alt="<%=ads01.getTitle()%>" src="<%=imgUrl%>">
				</a>
				<%
					}
				%>
			</div>
			<%
				} else if (isAdmin != null && isAdmin.equals("1")) {
			%>
			<div class="advWrap adv-250x250 clearafter">
				<div>
					<a
						href="/admin/advertising/add?place=<%=place%>&position=<%=position%>"
						title="Add Advertising">Add Advertising Here (250 x 250)</a>
				</div>
			</div>
			<%
				}
			%>
			<%
				PlaylistModel pModel = new PlaylistModel();
				pModel.setLimit(20);
				pModel.prepareList(true);
				if (pModel.getListResult().size() > 0) {
			%>
			<div class="box-green">
				<h3 class="title">Playlist</h3>
				<div class="box-content">
					<ul class="item-listing">
						<%
							for (Playlist p : pModel.getListResult()) {
									String imgUrl = p.getImageKey();
									if (!imgUrl.isEmpty()) {
										imgUrl = "/image?key=" + imgUrl + "&size=195";
									} else {
										imgUrl = "/images/tube.png";
									}
						%>
						<li class="clearafter">
							<div class="description">
								<h4>
									<a href="/playlist/<%=p.getId()%>/<%=p.getAlias() %>" title="<%=p.getTitle()%>"><%=p.getTitle()%></a>
								</h4>
								<a href="/playlist/<%=p.getId()%>/<%=p.getAlias() %>"
									title="<%=p.getDescription()%>"> <%=p.getDescription()%>
								</a>
							</div> <a class="link-image-scale" href="/playlist/<%=p.getId()%>/<%=p.getAlias() %>"
							title="<%=p.getTitle()%>"> <span><img
									src="<%=imgUrl%>" alt="<%=p.getTitle()%>"
									title="<%=p.getTitle()%>" /></span>
						</a>
						</li>
						<%
							}
						%>
					</ul>
				</div>
			</div>
			<%
				}
			%>
			<%
             	position = 998;
          		ads01 = AdvertisingModel.getByPlaceAndPosition(place, position);
          		if(ads01!=null&&ads01.getId().length()>0){
          			%> 
          			<div class="advWrap adv-250x250 clearafter" style="border: none;">
						<div>
	          				<%
	          					if(ads01.getType()==1){
	          						%>
	          						<%=ads01.getContent() %>	
	          						<%
	          					}else{
	          						String imgUrl = ads01.getContent();
	                       			imgUrl = "/image?key=" + imgUrl + "&size=250";
	          						%>
	          						<a title="<%=ads01.getTitle()%>" href="<%=ads01.getLink()%>">
	          							<img alt="<%=ads01.getTitle() %>" src="<%=imgUrl%>">
	          						</a> 
	          						<%
	          					}
	          				%>          				
	          			</div>
          			</div>
          			<%
          		}else if(isAdmin!=null&&isAdmin.equals("1")){
            		%>
                	<div class="advWrap adv-250x250 clearafter">
						<div>
                    		<a href="/admin/advertising/add?place=<%=place %>&position=<%=position %>" title="Add Advertising">Add Advertising Here (250 x 250)</a>			             
                    	</div>
                    </div>
            		<%
            	}
         	%>	
		</aside>
	</div>
</div>